package com.mz.mattress.api.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * 优惠券状态
 */
public enum CouponStatusEnum {

//    0未使用；1使用中；2已使用；3已过期；4已下架
    UNUSED(0, "未使用"),
    INUSE(1, "使用中"),
    USED(2, "已使用"),
    EXPIRED(3, "已过期"),
    CLOSED(4, "已下架");

    private Integer value;

    private String desc;

    CouponStatusEnum(final Integer value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    private static Map<Integer, CouponStatusEnum> map = new HashMap<>();

    static {
        for (CouponStatusEnum stepEnum : CouponStatusEnum.values()) {
            map.put(stepEnum.value, stepEnum);
        }
    }

    public static CouponStatusEnum valueOf(int value) {
        return map.get(value);
    }

    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }
}
